import mongoose from 'mongoose';
import BaseModel from './base_model';

const Schema = mongoose.Schema;
const ObjectId = Schema.ObjectId;

const TopicCollectSchema = new Schema({
  appId:      { type: String, requried: true },
  user_id:    { type: ObjectId, requried: true },
  topic_id:   { type: ObjectId, requried: true },
  create_at:  { type: Date, default: Date.now },
});

TopicCollectSchema.plugin(BaseModel);
TopicCollectSchema.index({ user_id: 1, topic_id: 1 }, { unique: true });

mongoose.model('TopicCollect', TopicCollectSchema);
